-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Core] Improve caching glue performance #2971
Conversation
cucumber-core/src/main/java/io/cucumber/core/runner/CachingGlue.java
Outdated
Show resolved
Hide resolved
cucumber-core/src/main/java/io/cucumber/core/runner/CachingGlue.java
Outdated
Show resolved
Hide resolved
cucumber-core/src/main/java/io/cucumber/core/runner/CachingGlue.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Technically this looks way more manageable then I expected.
To keep the scope of this PR manageable, I think it would be prudent to initially always consider the cache dirty in the presence of ScenarioScoped
glue code.
It means we won't get the performance gains for cucumber-java8
but we can then look removing ScenarioScoped
from cucumber-java8
separately. If there are other backends that do use ScenarioScoped
glue, they can either stop using that or contribute the next improvement.
27d5201
to
f3efd5d
Compare
cucumber-core/src/main/java/io/cucumber/core/runner/CachingGlue.java
Outdated
Show resolved
Hide resolved
cucumber-core/src/main/java/io/cucumber/core/runner/CachingGlue.java
Outdated
Show resolved
Hide resolved
cucumber-java8/src/main/java/io/cucumber/java8/ClosureAwareGlueRegistry.java
Show resolved
Hide resolved
TODO:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for doing the initial leg work.
This also had a positive knock on effect on the number of messages created by Cucumber. Because we're reusing step definitions they don't need to be redefined for each scenario.
So that's an improvement of # scenarios * # step definitions
to just # step definitions
.
642fa29
to
d091541
Compare
d091541
to
999493e
Compare
🤔 What's changed?
The
CachingGlue
performance has been improved by caching the following elements:The cache is invalidated when a parameter type or a step definition is added/removed, or when the language changes.
The cache is not used when scenario-scoped glue is present (e.g. cucumber-java8).
⚡️ What's your motivation?
This improves the
CachingGlue
performance.On a personal project with about 250 step definitions and 1000 test scenarios, the performance is the following:
🏷️ What kind of change is this?
♻️ Anything particular you want feedback on?
I'm not 100% sure about whether
cucumber-java8
has still the same behavior, but at least the unit tests did not change.I accidentally deleted the original PR, sorry.
📋 Checklist: